package com.cx.mall.demo.controller;

import com.cx.mall.common.model.user.UserInfo;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class ThymeleafController {
    @GetMapping("/th/demo")
    public String demo(ModelMap model){
        // 用于封装模板引擎的数据
        model.put("name","张三");
        model.put("age",18);
        // 跳转到demo.html
        UserInfo userInfo = new UserInfo();
        userInfo.setId(1L);
        userInfo.setUsername("张三");
        model.put("userInfo",userInfo);
        return "demo";

    }
}
